Add schedule route map with sharing and export improvements#1148
Add schedule route map with sharing and export improvements#1148abdulm5 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c23128757
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| locatedStops.filter( | ||
| (stop, index, stops) => | ||
| index === 0 || | ||
| !sameCoordinates(stop.coordinates, stops[index - 1].coordinates) |
There was a problem hiding this comment.
Preserve route legs after same-location stops
When a day has consecutive meetings in the same building followed by a different building (A, A, B), this filter drops the second A from routeStops, so legByStopPair stores the fetched leg under the first A's key. The sidebar later looks up the leg for the actual adjacent pair (second A -> B) and shows "Route unavailable" even though the route was fetched. Keep enough stop identity to map the deduped route segment back to the last same-location stop before the next move.
Useful? React with 👍 / 👎.
| useEffect(() => { | ||
| if (selectedScheduleId || availableSchedules.length === 0) return; | ||
|
|
||
| const containerRef = useRef<HTMLDivElement | null>(null); | ||
| const firstSchedule = availableSchedules[0]; | ||
| if (firstSchedule) setSearchParams({ schedule: firstSchedule._id }); |
There was a problem hiding this comment.
Recover from stale schedule query ids
If a user opens /map?schedule=<id> with an id that is no longer in their schedules (for example after deletion, sharing a stale URL, or switching dev users), selectedScheduleId is truthy so the effect never falls back to an available schedule. When useReadSchedule returns no schedule, the render path below keeps showing the loading indicator forever instead of selecting a valid schedule or showing an error.
Useful? React with 👍 / 👎.
/mappage for viewing routes between scheduled class locationsTesting:
npm run type-check --workspace apps/frontendnpm run lint --workspace apps/frontendnpm test --workspace apps/frontendnpm run build --workspace apps/frontendnpm run type-check --workspace apps/backendnpm run lint --workspace apps/backendnpm run build --workspace apps/backendnpm run type-check/mapempty state and dev login flow